import 'package:flutter/material.dart';
import 'package:ichinesereader/models/book/BookDetails.dart';
import './singleBookGridNoBar.dart';
//import 'package:getwidget/getwidget.dart';

class BookSliderGridNoBar2 extends StatefulWidget {
  BookSliderGridNoBar2({
    Key? key,
    required this.books,
  }) : super(key: key);
  final List<BookDetails> books;

  @override
  _BookSliderGridNoBar2 createState() => _BookSliderGridNoBar2();
}

class _BookSliderGridNoBar2 extends State<BookSliderGridNoBar2>
    with SingleTickerProviderStateMixin {
  @override
  Widget build(BuildContext context) {
    var books = widget.books;
    return Scaffold(
      body: SizedBox(
        width: double.infinity,
        height: 350,
        child: GridView.builder(
          padding: EdgeInsets.zero,
          scrollDirection: Axis.horizontal,
          itemCount: books.length,
          gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
              maxCrossAxisExtent: 350,
              childAspectRatio: 250 / 156,
              crossAxisSpacing: 20,
              mainAxisSpacing: 20),
          itemBuilder: (context, index) {
            return ClipRRect(
              child: SingleBookGridNoBar(
                bid: books[index].bookId!,
                btitle: books[index].bookTitle!,
                bcode:
                    books[index].bookCode != null ? books[index].bookCode! : '',
                bimage: books[index].bookImageLink!,
                color: books[index].color != null
                    ? books[index].color!
                    : '#808080',
                bookLevel: books[index].bookLevel != null
                    ? books[index].bookLevel!
                    : '0',
                viewMode: books[index].viewMode ?? 'LANDSCAPE',
              ),
            );
          },
        ),
      ),
    );
  }
}
